home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / presto / presto10.lha / src / timer.h < prev    next >
C/C++ Source or Header  |  1991-12-11  |  692b  |  36 lines

  1. #ifndef __presto__timer_h__
  2. #define __presto__timer_h__
  3. /*
  4.  * Generic clock interface
  5.  */
  6.  
  7.  
  8. #ifndef ITIMER_REAL
  9. #include <sys/time.h>
  10. #endif
  11.  
  12. extern int gettimeofday(struct timeval*, struct timezone*);
  13.  
  14. class Timer : public Object    {
  15.     double t_starttime;
  16.     struct timeval t_time;
  17. public:
  18.  
  19.     Timer() {}                // satisfy compiler
  20.     void init();                // intentional ctor only
  21.     ~Timer();
  22.     struct timeval *getdaytime();
  23.     double getabsolutetime();
  24.     char *getasciitime();
  25.     void  timerstart()
  26.         { t_starttime = getabsolutetime(); }
  27.     void reinit()
  28.         { timerstart(); }
  29.     double timermark()
  30.         { return getabsolutetime() - t_starttime; }
  31.     virtual void print(ostream& = cout);
  32. };
  33.  
  34.  
  35. #endif /* __presto__timer_h__ */
  36.